<?php
class Logger_Data_Singlelog {
	
	private $database;
	private $secure;
	
	public function __construct(){
		$this->secure = new Core_Data_Secure();
		$this->database = new Core_Driver_MysqlImproved();
	}
	
	public function getData(array $getVars){
		$getVars = $this->secure->parseData($getVars);
		
		$id = $getVars['page'];
		
		$this->database->connect();
		$id = $this->database->escape($id);
		$this->database->prepare(
			"select * from logger where id = '$id';"
		);
		$this->database->query();
		$logData = $this->database->fetch('array');
		$article['template'] = "./logger/views/alllogs.php";
		$article['content'] = "<h1>".CURRENT_LOG_TITLE."</h1>";
		$article['content'] .= '<p style="padding: 0 0 10px 0; text-align: center;">'.CURRENT_LOG_MESSAGE.'</p>';
		$article['content'] .= "<p>".CURRENT_LOG_CURRENT_TIME.'<strong>'.$logData['actual_time'].'</strong></p>';
		$article['content'] .= "<p>".CURRENT_LOG_CLIENT_IP.'<strong>'.$logData['client_ip'].'</strong></p>';
		$article['content'] .= "<p>".CURRENT_LOG_CLIENT_HOST.'<strong>'.$logData['client_host'].'</strong></p>';
		$article['content'] .= "<p>".CURRENT_LOG_CLIENT_DATA.'<br><strong>'.$logData['client_data'].'</strong></p>';
		$article['content'] .= "<p>".CURRENT_LOG_REQUEST_URL."<strong>".$logData['request_url'].'</strong></p>';
		$article['content'] .= "<p>".CURRENT_LOG_REQUEST_REFERER."<strong>".$logData['request_referer'].'</strong></p>';
		$article['content'] .= "<p>".CURRENT_LOG_CLIENT_USERNAME."<strong>".$logData['client_name'].'</strong></p>';
		$article['content'] .= "<p>".CURRENT_LOG_CLIENT_ACCESS_LEVEL."<strong>".$logData['client_access_level'].'</strong></p>';
		return $article;
	}
}